/*
 * @Description: 
 * @Author: yyh
 * @Date: 2022-03-06 17:25:44
 * @LastEditors: yyh
 * @LastEditTime: 2022-04-22 00:49:04
 */
/*
 * @Description: 
 * @Author: yyh
 * @Date: 2022-03-06 17:25:44
 * @LastEditors: yyh
 * @LastEditTime: 2022-03-06 17:42:46
 */
var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var cors = require("cors");
var logger = require('morgan');

var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var assetsRouter = require('./routes/assets');
var classificationRouter = require('./routes/classification');
var useRouter = require('./routes/use');
var borrowingRouter = require('./routes/borrowing');
var maintenanceRouter = require('./routes/maintenance');
var scrapRouter = require('./routes/scrap');


var app = express();

var http = require('http');
var server = http.createServer(app);

app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
//静态资源
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', indexRouter);
//资产分类接口
app.use('/classification',classificationRouter);
// 资产列表接口
app.use('/assets',assetsRouter);
// 资产使用接口
app.use('/use',useRouter);
// 资产借用接口
app.use('/borrowing',borrowingRouter);
// 资产维修接口
app.use('/maintenance',maintenanceRouter);
// 资产报废接口
app.use('/scrap',scrapRouter);
// 用户接口
app.use('/users', usersRouter);

server.listen('3000', function(){
  console.log("3000 server is running");
});